package com.ruoyi.web.controller.minglvmini;


import com.minglv.mini.service.MiniProgramLoginSerivce;
import com.minglv.mini.tools.MiniResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.Map;

@Api(tags = "API-微信小程序登录")
@RestController
@RequestMapping("/api/login")
public class MiniProgramLoginController {


    @Resource
    MiniProgramLoginSerivce miniProgramLoginSerivce;

    /**
     *
     * @param req
     * @return
     */
    @PostMapping("/login")
    @ApiOperation("微信小程序")
    public MiniResult login(@RequestBody Map req){

        String code =  req.get("code").toString();

        Map map = miniProgramLoginSerivce.miniLogin(req);

        MiniResult miniResult = new MiniResult(200, "登录成功", map);

        return  miniResult;
    }

}
